<template>
	<view class="container">
		<view class="list">
			<view v-for="(item,index) in list" class="item" @click="goDetail(item,index)">
				<view class="wushi">房间号：{{item.applyHouse}}</view>
				<view class="wushi">分类：{{item.applyCategory}}</view>
				<view class="wushi">回访内容：{{item.applyContent}}</view>
				<view class="wushi">姓名：{{item.applyName}}</view>
				<view class="wushi">电话：{{item.applyPhone}}</view>
				<view class="wushi">来源：{{item.client}}</view>
				<view class="wushi">状态：{{item.state}}</view>
			</view>
			<!-- <button class="sendBtn" @click="goDetail()">+</button> -->
		</view>
	</view>
</template>

<script>
	import {
		flowRepair
	} from "@/api/home.js"
	export default {
		data() {
			return {
				list: [],
				queryParams: {
					pageNum: 1,
					pageSize: 10,
					state: '已维修'
				},
				total: 0,
			}
		},
		onPullDownRefresh() {
			// 下拉刷新
			this.queryParams.pageNum = 1;
			this.list = [];
			this.getList();
		},
		onReachBottom() {
			// 上拉加载更多
			let quantity = this.queryParams.pageNum * this.queryParams.pageSize
			if (this.total > quantity) {
				this.queryParams.pageNum++;
				this.getList();
			} else {
				uni.showToast({
					title: "没有数据了",
					icon: "none"
				})
			}
		},
		onload() {
			this.queryParams.currentPage = 1;
			this.list = [];
			this.getList();
		},
		methods: {
			getList() {
				var data = this.queryParams
				flowRepair(data).then(res => {
					uni.stopPullDownRefresh();
					if (res.code == 200) {
						this.list = this.list.concat(res.rows);
						this.total = res.total;
					}
				}).catch(err => {
					uni.stopPullDownRefresh();
				})
			},
			sendInfo() {
				uni.navigateTo({
					url: "/pages/home/goBack/send"
				})
			},
			goDetail(item, index) {
				uni.navigateTo({
					url: "/pages/home/goBack/detail?detail=" + JSON.stringify(item)
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.list {
		width: 100%;
		overflow: hidden;

		.item {
			width: calc(100vw - 44px);
			overflow: hidden;
			padding: 10px;
			margin: 10px;
			line-height: 30px;
			font-size: 15px;
			border: 2px solid #81b0ff;
			border-radius: 8px;
			background-color: #ffffff;
			box-shadow: 2px 2px 5px 0px #035883;
		}

		.wushi {
			width: 50%;
			float: left;
		}

	}

	.item:last-child {
		border: none;
	}

	.sendBtn {
		position: fixed;
		bottom: 40px;
		right: 50px;
		width: 50px;
		height: 50px;
		line-height: 50px;
		text-align: center;
		border-radius: 50px;
		border: none;
		background: #00aaff;
		color: #fff;
		font-size: 30px;
	}
</style>